@echo off

rd /s /q ..\CompiledBinaries
md ..\CompiledBinaries

rd /s /q Byond\bin
rd /s /q Byond\obj

rd /s /q Byond.Standalone\bin
rd /s /q Byond.Standalone\obj

rd /s /q Byond.Vst\bin
rd /s /q Byond.Vst\obj

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe Byond.sln /p:Configuration=Release /t:Rebuild /verbosity:m
if not %ERRORLEVEL%==0 pause

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe Byond.sln /p:Configuration=Synth /t:Rebuild /verbosity:m
if not %ERRORLEVEL%==0 pause

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe Byond.sln /p:Configuration=Effect /t:Rebuild /verbosity:m
if not %ERRORLEVEL%==0 pause

rename "Byond.Vst\bin\synth\Byond.Vst.dll" Byond.Vst.Synth.dll"
rename "Byond.Vst\bin\effect\Byond.Vst.dll" Byond.Vst.Fx.dll

xcopy /q /y /E "Byond.Standalone\bin\release" "..\CompiledBinaries\Byond.Standalone\"
xcopy /q /y /E "Byond.Vst\bin\synth" "..\CompiledBinaries\Byond.Vst\"
xcopy /q /y /E "Byond.Vst\bin\effect" "..\CompiledBinaries\Byond.Vst\"

del "..\CompiledBinaries\Byond.Standalone\*.pdb"
del "..\CompiledBinaries\Byond.Vst\*.pdb"

xcopy /q /y /E "..\_byondUserFolder" "..\CompiledBinaries\Byond.Standalone\FactoryLibrary\"
xcopy /q /y /E "..\_byondUserFolder" "..\CompiledBinaries\Byond.Vst\FactoryLibrary\"

make_docu.cmd

pause